package main

import (
	"github.com/prometheus/common/log"
	"github.com/sp-bridge/pkg/conf"
	"github.com/sp-bridge/pkg/route"
	"github.com/valyala/fasthttp"
	"runtime"
)

func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())
	addr := "127.0.0.1:80"
	option := &conf.Option{}
	p := &route.Proxy{}
	server := &fasthttp.Server{
		Handler:            p.ServeFastHTTP,
		ReadBufferSize:     option.LimitBufferRead,
		WriteBufferSize:    option.LimitBufferWrite,
		MaxRequestBodySize: option.LimitBytesBody,
	}
	err := server.ListenAndServe(addr)
	if err != nil {
		log.Errorf("发生异常：%s", err)
	}
}
